using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

/// <summary>
/// Summary description for RuleDao
/// </summary>
public class RuleDao
{
    public Rule LoadRule()
    {
        string proc = "sp_LoadRule";
        DataSet ds = DbProvider.LoadData(proc);
        
        DataRow row = ds.Tables[0].Rows[0];
        decimal imgCost = Convert.ToDecimal(row["ImgCost"]);
        decimal minGap = Convert.ToDecimal(row["MinGap"]);
        decimal maxGap = Convert.ToDecimal(row["MaxGap"]);
        decimal quickCost = Convert.ToDecimal(row["QuickCost"]);
        int minInBid = Convert.ToInt32(row["MinInBid"]);
        int maxInBid = Convert.ToInt32(row["MaxInBid"]);
        int maxReturn = Convert.ToInt32(row["MaxReturn"]);
        Rule dto = new Rule(imgCost, minGap, maxGap, quickCost, minInBid, maxInBid, maxReturn);

        ds.Dispose();
        return dto;
    }
}
